#define  _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;
#include "BSTree.h"
#include <vector>

void Test1()
{
	vector<int> arr{10, 5, 15, 3, 13, 18, 4, 7, 9, 16};
	BSTree<int> t1;
	for (auto e : arr)
	{
		t1.insert(e);
	}
	t1.InOrder();

	//cout << t1.find(18);
	t1.erase(18);
	t1.InOrder();

	t1.erase(15);
	t1.InOrder();

	t1.erase(13);
	t1.InOrder();

	t1.erase(16);
	t1.InOrder();

	t1.erase(10);
	t1.InOrder();
	for (auto e : arr)
	{
		t1.erase(e);
		t1.InOrder();
	}
}
void Test2()
{
	vector<int> arr{10, 5, 15, 3, 13, 18, 4, 7, 9, 16};
	BSTree<int> t1;
	for (auto e : arr)
	{
		t1.insertR(e);
	}
	t1.eraseR(3);

	BSTree<int> t2(t1);
	for (auto e : arr)
	{
		t2.eraseR(e);
		t2.InOrder();
	}


	t1.InOrder();
	cout << t1.findR(18) << endl;
	cout << t1.findR(120) << endl;

	t1.eraseR(18);
	t1.InOrder();

	t1.eraseR(15);
	t1.InOrder();

	t1.eraseR(13);
	t1.InOrder();

	t1.eraseR(16);
	t1.InOrder();

	t1.eraseR(10);
	t1.InOrder();
	for (auto e : arr)
	{
		t1.eraseR(e);
		t1.InOrder();
	}
}
void Test3()
{
	vector<int> arr{10, 5, 15, 3, 13, 18, 4, 7, 9, 16};
	BSTree<int> t1;
	for (auto e : arr)
	{
		t1.insertR(e);
	}

	BSTree<int> t2;
	t2 = t1;
	t2.InOrder();
}

int main()
{
	Test2();
	return 0;
}
